package bjut.zrpc.core.optimization.netty;

import bjut.zrpc.core.optimization.proctol.MessageDecoder;
import bjut.zrpc.core.optimization.proctol.MessageEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;


/**
 * @Author: zhuzhiming
 * @Date: 2022/6/24 14:41
 */
public class NettyClientInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {

        socketChannel.pipeline()
                //.addLast(new IdleStateHandler(0,60,0, TimeUnit.SECONDS))
                .addLast(new MessageEncoder())
                .addLast(new MessageDecoder())
                .addLast(new NettyClientHandler());

    }
}
